import shelve

def shelve_set(key,value):
    with shelve.open('myshelve') as db:
        # 存储数据
        db[key] = value

def shelve_get(key,default):
    with shelve.open('myshelve') as db:
         # return db[key]
           return db.get(key,default)

def shelve_clear():
     with shelve.open('myshelve') as db:
      db.clear()

if __name__ == '__main__':
    pc_path = 'D:\\视频\\美国女兵'
    shelve_set(pc_path,'aaaa')
    print(shelve_get(pc_path,'----'))
    shelve_clear()
    print(shelve_get(pc_path, '----'))

